package com.kimoge.spring6.validation.methodtwo;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author kimoge
 * @date 2025/8/30
 * @description
 */
public class TestDemo {

    @Test
    public void test01() {
        ApplicationContext context =
                new AnnotationConfigApplicationContext(ValidatorConfig.class);
        MyService1 myService1 = context.getBean("myService1", MyService1.class);
        Person person = new Person(null, -1, "男");
        boolean validator = myService1.validator(person);
        System.out.println(validator);
    }

    @Test
    public void test02() {
        ApplicationContext context =
                new AnnotationConfigApplicationContext(ValidatorConfig.class);
        MyService2 myService2 = context.getBean(MyService2.class);
        Person person = new Person("张三", 1, "未知");
        boolean b = myService2.validatorByValidator(person);
        System.out.println(b);
    }
}
